#include "tim6.h"


void tim6_init(void)
{
    //打开时钟
    RCC->APB1ENR|=RCC_APB1ENR_TIM6EN;

    //2.预分频 7200-1 ARR
    TIM6->PSC=7200-1;
    TIM6->ARR=10000-1;

    //使能中断
    TIM6->DIER|=TIM_DIER_UIE;

    //
    NVIC_SetPriorityGrouping(3);
    NVIC_SetPriority(TIM6_IRQn ,3);
    NVIC_EnableIRQ(TIM6_IRQn);


    TIM6->CR1|=TIM_CR1_CEN;

    //
}

void TIM6_IRQHandler(void)
{
    TIM6->SR&=~TIM_SR_UIF;

    led_tegger(LED2);
}